<?php
namespace app\admin\controller;

use think\Controller;
use think\Db;
use think\Request;
use think\Validate;
use think\Session;
use app\admin\model\User;

class Login extends Controller
{
	public function login()
	{
		Session::delete('user');
		$users = new User();
		if (Request::instance()->isPost()) {
			$data['name'] = input('post.name');
			$data['password'] = md5(input('post.password'));
			$user = $users->get_User($data);
			if ($user) {
				Session::set('user',$user['id']);
				$this->success('登录成功', 'index/index');
			}
		}
		return $this->fetch();
	}

	public function register()
	{
		return $this->fetch();
	}
}